<template>
  <div>
    <button @click="changeDisplay">点击隐藏/显示</button>
    <transition appear> <!--控制初次进入页面播放展示动画-->
        <h1 v-show="isplay">hello vue cli</h1>
    </transition>
    
  </div>
</template>

<script>
    export default {
        name:'animation',
        data:function(){
            return {
                isplay: false
            }
        },
        methods:{
            changeDisplay(){
                this.isplay = !this.isplay
            }
        }
    }
</script>

<style lang="css" scoped>
    h1{
        background-color: orange;
    }
    .v-enter-active{
        animation: anim linear 0.5s;
    }

    .v-leave-active{
        animation: anim  linear 0.5s reverse;
    }
    @keyframes anim {
        from {
            transform: translateX(-100%);
        }
        to{
            transform: translateX(0px);
        }
    }
</style>